//*******************************************************************************
// COPYRIGHT NOTES
// ---------------
// This is a sample for BCGControlBar Library Professional Edition
// Copyright (C) 1998-2016 BCGSoft Ltd.
// All rights reserved.
//
// This source code can be used, distributed or modified
// only under terms and conditions 
// of the accompanying license agreement.
//*******************************************************************************
//
// ChartStepLineView.cpp : implementation file
//

#include "stdafx.h"
#include "bcgpchartexample.h"
#include "ChartStepLineView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CChartStepLineView

IMPLEMENT_DYNCREATE(CChartStepLineView, CChartLineView)

CChartStepLineView::CChartStepLineView()
{
	m_nLineWidth = 2;
}

CChartStepLineView::~CChartStepLineView()
{
}

void CChartStepLineView::DoDataExchange(CDataExchange* pDX)
{
	CChartLineView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CChartStepLineView)
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CChartStepLineView, CChartLineView)
	//{{AFX_MSG_MAP(CChartStepLineView)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CChartStepLineView diagnostics

#ifdef _DEBUG
void CChartStepLineView::AssertValid() const
{
	CChartLineView::AssertValid();
}

void CChartStepLineView::Dump(CDumpContext& dc) const
{
	CChartLineView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CChartStepLineView message handlers

void CChartStepLineView::OnInitialUpdate() 
{
	CBCGPChartExampleView::OnInitialUpdate();
	
	if (m_bIsReady)
	{
		return;
	}

	m_bIsReady = TRUE;

	CBCGPChartVisualObject* pChart = m_wndChart.GetChart();
	ASSERT_VALID(pChart);

	pChart->SetChartType(BCGPChartLine);
	pChart->SetChartTitle(_T("Operation Expenses"));

	CBCGPChartSeries* pSeries1 = pChart->CreateSeries(_T("Series 1"));

	pSeries1->AddDataPoint(m_arYears[4], 5.);
	pSeries1->AddDataPoint(m_arYears[3], 8.);
	pSeries1->AddDataPoint(m_arYears[2], 4.);
	pSeries1->AddDataPoint(m_arYears[1], 10.);
	pSeries1->AddDataPoint(m_arYears[0], 2.);

	OnUpdateChart();
}
